package method;

/**
 * @Author Stringzhua
 * @Date 2024/2/7 18:17
 * description:
 */
public class MethodParameter01 {
    public static void main(String[] args) {
        int a = 10;
        int b = 20;
        //创建AA02对象 名字obj
        AA02 obj = new AA02();
        obj.swap(a, b);
        System.out.println("主方法:a=" + a + " b=" + b);
    }
}

class AA02 {
    public void swap(int a, int b) {
        System.out.println("\na和b交换前的值\na=" + a + "\tb=" + b);
        //完成了a和b的交换
        int temp = a;
        a = b;
        b = temp;
        System.out.println("\na和b交换后的值\na = " + a + "\tb=" + b);
    }
}
